﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Globalization;

namespace CodeFirstRelationMapping.Models
{
    public class BlogDbInitializer : AlwaysRecreateDatabase<BlogDb>
    {
        protected override void Seed(BlogDb postDb)
        {
            var posts = new List<Post>();

            for (int i = 0; i < 100; ++i)
            {
                posts.Add(new Post
                {
                    Title = "Post #" + (i + 1) + " - Battle: Los Angeles Mixes UFO Lore, Fallujah Feel",
                    Body = "SAN DIEGO — Graft urban combat’s raw intensity and a back story based on" +
                            "real events onto an explosive alien invasion and you’ve got Battle: Los Angeles,",
                    CreatedBy = "Bikal Gurung",
                    CreatedOn = DateTime.Parse("15/01/2010", new CultureInfo("en-GB"))
                });
            }
            posts.ForEach(post => postDb.Posts.Add(post));
        }
    }
}